﻿#ifndef SOURCEFILE_H
#define SOURCEFILE_H

#include <QFile>
#include <QString>

class SourceFile
{
public:
    SourceFile(QString key);
    SourceFile(QString key, QString content);

    SourceFile &replace(QString s_new);
    SourceFile &replaceUp(QString s_new);
    SourceFile &replaceLower(QString s_new);

    SourceFile &replace(QString s_old, QString s_new);
    SourceFile &replaceUp(QString s_old, QString s_new);

    QString &value();
    void writeToGBK(QFile &file);
    void writeToUtf8(QFile &file);
    void writeToUtf8Bom(QFile &file);

    QString filename(QString ext);

    void setClass(const QString &newClass);

private:
    QString m_key;
    QString m_content;

    QString m_class;
};

#endif // SOURCEFILE_H
